package banking;
public class Account {
    private double balance;
    public Account(double bal) {
        balance = bal;
    }
    public double getBalance() {
        return balance;
    }
    public boolean deposit(double amount) {
        balance = balance + amount;
        return true;
    }
    public boolean withdraw(double amount) {
        boolean result = true;
        if (balance < amount) {
            result = false;
        } else {
            balance = balance - amount;
        }
        return result;
    }
    // 添加 main 方法用于测试
    public static void main(String[] args) {
        Account account = new Account(100.0);
        System.out.println("初始余额: " + account.getBalance());
        account.deposit(50.0);
        System.out.println("存款 50 后余额: " + account.getBalance());
        boolean withdrawSuccess = account.withdraw(70.0);
        System.out.println("取款 70 是否成功: " + withdrawSuccess + "，余额: " + account.getBalance());
    }
}